package Object;

public class Intrger {
    public static void main(String[] args) {
        //valueof（）方法会复用1个字节（-128到127）范围内的数据，建议使用valueof（）
        Integer x = Integer.valueOf(127);
        Integer x1 = Integer.valueOf(127);
        System.out.println(x.equals(x1));//包装类重写了equals（）方法
        System.out.println(x == x1);

        Integer x2 = new Integer(127);
        Integer x3 = new Integer(127);
        System.out.println(x2 == x3);
        System.out.println(x2.equals(x3));

        Integer x4 = 9;//装箱
        int i = x3.intValue();
        int i1 = x4;//拆箱
        System.out.println(i);
        System.out.println(i1);

    }
}
